﻿package mortal.game.view.chat.chatPanel
{
    import com.gengine.utils.*;
    import com.mui.controls.*;
    import com.mui.display.*;
    import com.mui.utils.*;
    import flash.display.*;
    import flash.text.*;
    import mortal.common.global.*;
    import mortal.common.tools.*;
    import mortal.game.manager.*;
    import mortal.game.manager.msgTip.*;
    import mortal.game.resource.*;
    import mortal.game.view.common.*;

    public class HistoryMsg extends GSprite
    {
        protected var _bg:ScaleBitmap;
        private var _bgBmp:Bitmap;
        protected var _titleTextField:GTextFiled;
        protected var _contentTextField:GTextFiled;
        private static var _bgBmpd:BitmapData;

        public function HistoryMsg()
        {
            return;
        }// end function

        override protected function createDisposedChildrenImpl() : void
        {
            super.createDisposedChildrenImpl();
            if (!_bgBmpd)
            {
                this._bg = UIFactory.bg(5, 2, 40, 16, this, ImagesConst.ChatNotesBg);
                _bgBmpd = this._bg.bitmapData.clone();
            }
            this._bgBmp = UICompomentPool.getUICompoment(Bitmap);
            this._bgBmp.bitmapData = _bgBmpd;
            UIFactory.setObjAttri(this._bgBmp, 5, 2, 40, 16, this);
            this._titleTextField = UIFactory.gTextField("", 10, 0, 40, 18, this);
            this._contentTextField = UIFactory.gTextField("", 46, 0, 220, -1, this, GlobalStyle.textFormatPutong.setLeading(2));
            this._contentTextField.wordWrap = true;
            this._contentTextField.multiline = true;
            this._contentTextField.autoSize = TextFieldAutoSize.LEFT;
            return;
        }// end function

        override protected function disposeImpl(param1:Boolean = true) : void
        {
            this._titleTextField.dispose(param1);
            this._contentTextField.dispose(param1);
            if (this._bg)
            {
                this._bg.dispose(param1);
                this._bg = null;
            }
            UICompomentPool.disposeUICompoment(this._bgBmp);
            this._bgBmp = null;
            super.disposeImpl(param1);
            return;
        }// end function

        public function updateValue(param1:String, param2:MsgTypeImpl) : void
        {
            this._titleTextField.htmlText = HTMLUtil.addColor(param2.name, param2.color);
            var _loc_3:* = HTMLUtil.addColor("[" + DateParser.parse(ClockManager.instance.nowDate, "hh：mm：ss") + "]", "#ffff00");
            this._contentTextField.htmlText = _loc_3 + param1;
            return;
        }// end function

        override public function get height() : Number
        {
            return this._contentTextField.textHeight;
        }// end function

    }
}
